package work.jame.blog.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import work.jame.blog.framework.VerificationGroup;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author Jame
 * @since 2023-05-15
 */
@TableName("user_configuration")
public class UserConfiguration implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private Long id;

    /**
     * 用户id
     */
    @TableField("user_id")
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private Long userId;

    /**
     * 当新ip登录账号时操作 0无任何操作  1发送邮件提醒  2 发送邮件验证码验证
     */
    @Min(value = 0, message = "操作类型不存在")
    @Max(value = 2, message = "操作类型不存在")
    @TableField("new_ip_login_operation")
    private Integer newIpLoginOperation;

    /**
     * 当有人@当前用户时操作 0 无任何操作 1站内消息提醒 2站内和邮件提醒
     */
    @Min(value = 0, message = "操作类型不存在")
    @Max(value = 2, message = "操作类型不存在")
    @TableField("call_me_operation")
    private Integer callMeOperation;

    /**
     * 使用的壁纸id
     */
    @TableField("use_wallpaper_id")
    private Long useWallpaperId;

    @TableField("deleted")
    @TableLogic
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    @JsonIgnore
    private Boolean deleted;


    @TableField(value = "insert_time", fill = FieldFill.INSERT)
    @ApiModelProperty(hidden = true)
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private LocalDateTime insertTime;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(hidden = true)
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private LocalDateTime updateTime;


    public Long getUseWallpaperId() {
        return useWallpaperId;
    }

    public void setUseWallpaperId(Long useWallpaperId) {
        this.useWallpaperId = useWallpaperId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Integer getNewIpLoginOperation() {
        return newIpLoginOperation;
    }

    public void setNewIpLoginOperation(Integer newIpLoginOperation) {
        this.newIpLoginOperation = newIpLoginOperation;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public LocalDateTime getInsertTime() {
        return insertTime;
    }

    public void setInsertTime(LocalDateTime insertTime) {
        this.insertTime = insertTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getCallMeOperation() {
        return callMeOperation;
    }

    public void setCallMeOperation(Integer callMeOperation) {
        this.callMeOperation = callMeOperation;
    }

    @Override
    public String toString() {
        return "UserConfiguration{" +
                "id=" + id +
                ", userId=" + userId +
                ", newIpLoginOperation=" + newIpLoginOperation +
                ", callMeOperation=" + callMeOperation +
                ", useWallpaperId=" + useWallpaperId +
                ", deleted=" + deleted +
                ", insertTime=" + insertTime +
                ", updateTime=" + updateTime +
                '}';
    }
}
